<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<link type="text/css" href="<%=path%>/css/style.css" rel="stylesheet" />
<style>
input{
	height:30px;
	width:400px;
}
</style>
<script type="text/javascript" src="<%=path%>/js/jquery-1.11.0.min.js"></script>
<script>
	$(function(){
		
		$("#send").click(function(){
			$("#tip").text("调用中...");
			$("#returnObject").val("");
			var _i = $.trim($("#interface").val());
			var _m = $.trim($("#method").val());
			var _v = $.trim($("#version").val());
			var _p = $.trim($("#params").val());
			$.ajax({
				url : "<%=path%>/api",
				type : "POST",
				dataType : "json",
				data:{
						_i : _i,
						_m : _m,
						_v : _v,
						_p : _p
					},
				success : function(rs){
					$("#tip").text("返回结果");
					$("#returnObject").val(JSON.stringify(rs));
				},
				error : function(rs){
					$("#tip").text("返回结果");
					$("#returnObject").val(JSON.stringify(rs));
				}
			});
			
		});
		
	})
</script>
</head>
<body>
	<div class="header-div">test-post</div>
	<div class="test-div">
		<table>
			<tr><td>_i:</td><td><input type="text" id="interface" /></td></tr>
			<tr><td>_v:</td><td><input type="text" id="version" /></td></tr>
			<tr><td>_m:</td><td><input type="text" id="method" /></td></tr>
			<tr><td>_p:</td>
				<td>
					<textarea rows="10" cols="70" id="params">
					</textarea>
				</td>
				</tr>
				<tr><td></td>
					<td>
					<input type="button" id="send" value="调用" style="cursor:pointer;height:40px;width:100px;"/>
					<span id="tip" style="color:red;font-size: 12px;"></span>
					</td>
				</tr>
				<tr>
				<td>return:</td>
				<td>
					<textarea rows="10" cols="70" id="returnObject">
					</textarea>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>